&bl2_ep);
if (err) {
- /*
- * TODO: print failure to load BL2 but also add a tzwdog timer
- * which will reset the system eventually.
- */
ERROR("Failed to load BL2 firmware.\n");
- panic();
+ plat_error_handler(err);
}
/*
e = load_bl30();
if (e) {
ERROR("Failed to load BL3-0 (%i)\n", e);
- panic();
+ plat_error_handler(e);
}
/* Perform platform setup in BL2 after loading BL3-0 */
e = load_bl31(bl2_to_bl31_params, bl31_ep_info);
if (e) {
ERROR("Failed to load BL3-1 (%i)\n", e);
- panic();
+ plat_error_handler(e);
}
e = load_bl32(bl2_to_bl31_params);
if (e) {
if (e == -EAUTH) {
ERROR("Failed to authenticate BL3-2\n");
- panic();
+ plat_error_handler(e);
} else {
WARN("Failed to load BL3-2 (%i)\n", e);
}
e = load_bl33(bl2_to_bl31_params);
if (e) {
ERROR("Failed to load BL3-3 (%i)\n", e);
- panic();
+ plat_error_handler(e);
}
/* Flush the params to be passed to memory */
scratch registers. It should preserve the value in x18 register as it is used
by the caller to store the return address.
+### Function : plat_error_handler()
+
+ Argument : int
+ Return : void
+
+This API is called when the generic code encounters an error situation from
+which it cannot continue. It allows the platform to perform error reporting or
+recovery actions (for example, reset the system). This function must not return.
+
+The parameter indicates the type of error using standard codes from `errno.h`.
+Possible errors reported by the generic code are:
+
+* `-EAUTH`: a certificate or image could not be authenticated (when Trusted
+ Board Boot is enabled)
+* `-ENOENT`: the requested image or certificate could not be found or an IO
+ error was detected
+* `-ENOMEM`: resources exhausted. Trusted Firmware does not use dynamic
+ memory, so this error is usually an indication of an incorrect array size
+
+The default implementation simply spins.
+
3. Modifications specific to a Boot Loader stage
-------------------------------------------------
void plat_report_exception(unsigned long);
int plat_crash_console_init(void);
int plat_crash_console_putc(int c);
+void plat_error_handler(int err) __dead2;
/*******************************************************************************
* Mandatory BL1 functions
.weak plat_reset_handler
.weak plat_disable_acp
.weak bl1_plat_prepare_exit
+ .weak plat_error_handler
#if !ENABLE_PLAT_COMPAT
.globl platform_get_core_pos
func bl1_plat_prepare_exit
ret
endfunc bl1_plat_prepare_exit
+
+ /* -----------------------------------------------------
+ * void plat_error_handler(int err) __dead2;
+ * Endless loop by default.
+ * -----------------------------------------------------
+ */
+func plat_error_handler
+ b plat_error_handler
+endfunc plat_error_handler